<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use function MongoDB\BSON\toRelaxedExtendedJSON;

class User extends Model
{
    use HasFactory;
    protected $table = "user";

    /**
     * @param $data
     * @return bool
     */
    public function add($data)
    {
//        执行添加操作
        $this->name = $data['name'];
        $this->number = $data['number'];
        $this->numberState = $data['numberState'];
        $this->image = $data['images'];
        return $this->save();
    }


    /**
     * @param $id
     */
    public function del($id)
    {

//        执行删除操作
        $this->destroy($id);
        return true;
    }
}
